<?php

class LastNews extends CWidget {

    public function run() {
        $baseUrl = Yii::app()->request->baseUrl . '/';
        $models = Yii::app()->db->getCommandBuilder()->createSqlCommand('SELECT page_url, page_title, page_date, page_short_content, page_image FROM mp_articles WHERE page_type = \'news\' ORDER BY page_date DESC LIMIT 4')->queryAll();
        $this->render('lastNews', array('baseUrl' => $baseUrl, 'models' => $models));
    }

}
